package com.westos.userauth.service.impl;

import com.westos.userauth.service.IdService;
import com.westos.userauth.util.SnowflakeIdUtils;

import org.springframework.stereotype.Service;

import javax.xml.ws.ServiceMode;

/**
 * @Author: Youzg
 * @CreateTime: 2020-10-31 15:09
 * @Description: 带你深究Java的本质！
 */
@Service
public class IdServiceSnowImpl implements IdService {

    @Override
    public String getIdByName(String name) {
        SnowflakeIdUtils idWorker  = new SnowflakeIdUtils(0, 0);
        long nextId = idWorker.nextId();
        String id=name+String.valueOf(nextId);
        return id;
    }
}
